<template>
  <div id="unitshenghuohui">
    <el-breadcrumb separator=">">
      <el-breadcrumb-item><b>民主生活会数据填报</b></el-breadcrumb-item>
    </el-breadcrumb>
    <div id="tree" v-show="treeShow">
      <el-scrollbar style="height: calc(100% + 16px);width:260px;">
        <el-tree default-expand-all style="clear:both" node-key="index" @current-change="testf" :expand-on-click-node="false" :render-content="renderContent" class="filter-tree" :data="treedata" ref="tree2" empty-text="正在加载..." :default-expanded-keys="defaultkey" :props="myprops"></el-tree>
      </el-scrollbar>
    </div>
    <div id="unitShenghuohuidetail" :style="detailStyle">
      <index :timestamp="timestamp" v-if="itemLabel==='会前'||itemLabel==='会中'||itemLabel==='会后'" />
      <hqLingdao :timestamp="timestamp" v-if="itemLabel==='[01]单位班子基本情况'" />
      <hqFanganbaosong :timestamp="timestamp" v-if="itemLabel==='[02]方案报送及审核情况'" />
      <hqXuexi :timestamp="timestamp" v-if="itemLabel==='[03]学习研讨'" />
      <el-scrollbar style="height: calc(100% + 16px);width:100%;" v-if="itemLabel==='[04]征求意见'">
        <hqYijianyuanshi :timestamp="timestamp" />
      </el-scrollbar>
      <hqTanhua :timestamp="timestamp" v-if="itemLabel==='[05]谈心谈话'" />
      <hqCailiaobanzi :timestamp="timestamp" v-if="itemLabel==='[06]班子材料及审核情况'" />
      <hqCailiaochengyuan :timestamp="timestamp" v-if="itemLabel==='[07]班子成员材料及审核情况'" />
      <el-scrollbar style="height: calc(100% + 16px);width:100%;" v-if="itemLabel==='[01]会议程序'">
        <hsHuiyiyicheng :timestamp="timestamp" />
      </el-scrollbar>
      <el-scrollbar style="height: calc(100% + 16px);width:100%;" v-if="itemLabel==='[02]通报有关整改措施落实情况和征求意见情况'">
        <hzTongbaoqingkuang :timestamp="timestamp" />
      </el-scrollbar>
      <hsZiwopiping :timestamp="timestamp" v-if="itemLabel==='[03]自我批评'" />
      <hsPiping :timestamp="timestamp" v-if="itemLabel==='[04]相互批评'" />
      <hsChengyuanbaogao :timestamp="timestamp" v-if="itemLabel==='[05]班子成员报告'" />
      <hsLingdaocanhui :timestamp="timestamp" v-if="itemLabel==='[06]上级部门和督导组到会指导情况'" />
      <el-scrollbar style="height: calc(100% + 16px);width:100%;" v-if="itemLabel==='[07]上级部门和督导组点评意见'">
        <hsZhidaozudianping :timestamp="timestamp" />
      </el-scrollbar>
      <hhBanzizhenggai :timestamp="timestamp" v-if="itemLabel==='[01]班子整改清单'" />
      <hhChengyuanzhenggai :timestamp="timestamp" v-if="itemLabel==='[02]班子成员整改清单'" />
      <hhTongbao :timestamp="timestamp" v-if="itemLabel==='[03]通报民主生活会召开情况'" />
      <el-scrollbar style="height: calc(100% + 16px);width:100%;" v-if="itemLabel==='[04]会议情况报告'">
        <hhHuiyibaogao :timestamp="timestamp" />
      </el-scrollbar>
    </div>
  </div>
</template>
<script>
import index from './edit2022/index.vue'
import hqLingdao from './edit2022/hqLingdao.vue'
import hqFanganbaosong from './edit2022/hqFanganbaosong.vue'
import hqXuexi from './edit2022/hqXuexi.vue'
import hqYijianyuanshi from './edit2022/hqYijianyuanshi.vue'
import hqTanhua from './edit2022/hqTanhua.vue'
import hqCailiaobanzi from './edit2022/hqCailiaobanzi.vue'
import hqCailiaochengyuan from './edit2022/hqCailiaochengyuan.vue'
import hsHuiyiyicheng from './edit2022/hsHuiyiyicheng.vue'
import hzTongbaoqingkuang from './edit2022/hzTongbaoqingkuang.vue'
import hsZiwopiping from './edit2022/hsZiwopiping.vue'
import hsPiping from './edit2022/hsPiping.vue'
import hsChengyuanbaogao from './edit2022/hsChengyuanbaogao.vue'
import hsLingdaocanhui from './edit2022/hsLingdaocanhui.vue'
import hsZhidaozudianping from './edit2022/hsZhidaozudianping.vue'
import hhBanzizhenggai from './edit2022/hhBanzizhenggai.vue'
import hhChengyuanzhenggai from './edit2022/hhChengyuanzhenggai.vue'
import hhTongbao from './edit2022/hhTongbao.vue'
import hhHuiyibaogao from './edit2022/hhHuiyibaogao.vue'
export default {
  components: {
    index,
    hqLingdao,
    hqFanganbaosong,
    hqXuexi,
    hqYijianyuanshi,
    hqTanhua,
    hqCailiaobanzi,
    hqCailiaochengyuan,
    hsHuiyiyicheng,
    hzTongbaoqingkuang,
    hsZiwopiping,
    hsPiping,
    hsChengyuanbaogao,
    hsLingdaocanhui,
    hsZhidaozudianping,
    hhBanzizhenggai,
    hhChengyuanzhenggai,
    hhTongbao,
    hhHuiyibaogao
  },
  data () {
    return {
      itemLabel: '会前',
      btnLoading: false,
      usertimestamp: '',
      userlist1: [],
      userlist2: [],
      userlist3: [],
      userlist4: [],
      userlist5: [],
      myuserid: '',
      DicRoles: [],
      loadingtext: '选择左侧树中用户查看用户信息',
      userAddFormVisible: false, // 编辑界面是否显示
      userAddFormLoading: false,
      userAddForm: {
        UserName: '',
        PassWord: '',
        TrueName: '',
        UnitName: '',
        Managedep: [],
        Enable: '停用',
        Otherunitname: ''
      },
      roleoptions: [],
      deptoptions: [],
      managedepopthions: [],
      showmanagedep: false,
      showOtherunitname: false,
      myprops: {
        isLeaf: 'isLeaf'
      },
      treeVisible: true,
      form: {
        name: '',
        region: '',
        date1: '',
        date2: '',
        delivery: false,
        type: [],
        resource: '',
        desc: ''
      },
      treeShow: true,
      value1: true,
      treedata: [
        {
          'className': 'tree-icon iconfont icon-wenjianjia1 ',
          'isLeaf': false,
          'label': '会前',
          'children': [
            {'className': 'tree-icon iconfont icon-cf-c24 ', 'isLeaf': true, 'label': '[01]单位班子基本情况', currentFlag: false},
            {'className': 'tree-icon iconfont icon-cf-c24 ', 'isLeaf': true, 'label': '[02]方案报送及审核情况', currentFlag: false},
            {'className': 'tree-icon iconfont icon-cf-c24 ', 'isLeaf': true, 'label': '[03]学习研讨', currentFlag: false},
            {'className': 'tree-icon iconfont icon-cf-c24 ', 'isLeaf': true, 'label': '[04]征求意见', currentFlag: false},
            {'className': 'tree-icon iconfont icon-cf-c24 ', 'isLeaf': true, 'label': '[05]谈心谈话', currentFlag: false},
            {'className': 'tree-icon iconfont icon-cf-c24 ', 'isLeaf': true, 'label': '[06]班子材料及审核情况', currentFlag: false},
            {'className': 'tree-icon iconfont icon-cf-c24 ', 'isLeaf': true, 'label': '[07]班子成员材料及审核情况', currentFlag: false}
          ]
        },
        {
          'className': 'tree-icon iconfont icon-wenjianjia1 ',
          'isLeaf': false,
          'label': '会中',
          'children': [
            {'className': 'tree-icon iconfont icon-cf-c24 ', 'isLeaf': true, 'label': '[01]会议程序', currentFlag: false},
            {'className': 'tree-icon iconfont icon-cf-c24 ', 'isLeaf': true, 'label': '[02]通报有关整改措施落实情况和征求意见情况', currentFlag: false},
            {'className': 'tree-icon iconfont icon-cf-c24 ', 'isLeaf': true, 'label': '[03]自我批评', currentFlag: false},
            {'className': 'tree-icon iconfont icon-cf-c24 ', 'isLeaf': true, 'label': '[04]相互批评', currentFlag: false},
            {'className': 'tree-icon iconfont icon-cf-c24 ', 'isLeaf': true, 'label': '[05]班子成员报告', currentFlag: false},
            {'className': 'tree-icon iconfont icon-cf-c24 ', 'isLeaf': true, 'label': '[06]上级部门和督导组到会指导情况', currentFlag: false},
            {'className': 'tree-icon iconfont icon-cf-c24 ', 'isLeaf': true, 'label': '[07]上级部门和督导组点评意见', currentFlag: false}
          ]
        },
        {
          'className': 'tree-icon iconfont icon-wenjianjia1 ',
          'isLeaf': false,
          'label': '会后',
          'children': [
            {'className': 'tree-icon iconfont icon-cf-c24 ', 'isLeaf': true, 'label': '[01]班子整改清单', currentFlag: false},
            {'className': 'tree-icon iconfont icon-cf-c24 ', 'isLeaf': true, 'label': '[02]班子成员整改清单', currentFlag: false},
            {'className': 'tree-icon iconfont icon-cf-c24 ', 'isLeaf': true, 'label': '[03]通报民主生活会召开情况', currentFlag: false},
            {'className': 'tree-icon iconfont icon-cf-c24 ', 'isLeaf': true, 'label': '[04]会议情况报告', currentFlag: false}
          ]
        }
      ],
      defaultProps: {
        children: 'children',
        label: 'label'
      },
      mydeptnode: {},
      TreeLoading: false,
      detailStyle: {
        margin: '0 0 0 280px',
        width: 'calc(100% - 290px)',
        overflow: 'hidden'
      },
      btnStyle: 'treebtn',
      childdata: [],
      defaultkey: [],
      updateLogText: {},
      userAddFormRules: {
        UserName: [
          { required: true, message: '请输入用户名', trigger: 'blur' }
        ],
        TrueName: [
          { required: true, message: '请输入真实姓名', trigger: 'blur' }
        ],
        UnitName: [
          { required: true, message: '请选择部门', trigger: 'blur' }
        ]
      },
      ModuleList: [],
      settingVisible: false,
      timestamp: '',
      saveLoading: false,
      isotheruser: false
    }
  },
  methods: {
    testf (data) {
      console.log(data)
      this.timestamp = new Date().getTime()
      this.itemLabel = this.$refs.tree2.getCurrentNode()['label']
      this.treedata.forEach(item => {
        item.children.forEach(it => {
          it.currentFlag = it.label === data.label
        })
      })
    },
    renderContent (h, { node, data, store }) {
      console.log('测试：' + this.value1)
      return (
        <span class="custom-tree-node" style="width:100%" title={data.title}>
          <i class={data.className} />
          <span style="line-height:28px" class={data.currentFlag ? 'currentFlag' : ''}>{node.label}</span>
        </span>
      )
    },
    checkCurrentUserAuth () {
      if (localStorage.getItem('shenghuohuiunitId')) {
        this.$http
          .get(this.$http.defaults.shenghuohuiAPI + `api/newFlow/checkCurrentUserAuth?shenghuohuiUnitId=` + localStorage.getItem('shenghuohuiunitId'))
          .then(response => {
            this.infoLoading = false
            if (response.data.success === false) {
              console.log('获取数据失败:' + response.data.message)
              this.$message({
                message: '获取数据失败:' + response.data.message,
                type: 'error'
              })
              if (response.data.message === '发生错误：当前用户无权操作') {
                this.$router.push({name: `unitShenghuohuiList`})
              }
            }
          })
          .catch(error => {
            console.log(error)
            this.$message({
              message: '网络获取失败:' + error,
              type: 'error'
            })
            this.infoLoading = false
          })
      } else {
        this.$router.push({name: `unitShenghuohuiList`})
      }
    }
  },
  mounted () {
    this.checkCurrentUserAuth()
  }
}
</script>
<style>
#unitshenghuohui #tree .currentFlag{
  font-weight: bolder;
  /* color: red !important; */
}
#unitshenghuohui #tree i{
  padding-right:5px;
}
#unitshenghuohui #tree {
  width: 260px !important;
  border:1px solid #95B8E7;
  height: calc(100% - 140px);
  background: #fff !important;
  padding-right:0;
  margin-top:0;
  margin-left:10px;
  overflow: hidden;
  float: left;
  position: fixed;
}
#unitshenghuohui .treebtn{
  background:url(../assets/hidetree.png) no-repeat;
  left:273px;
  width:7px;
  height:28px;
  position:fixed;
  top: calc(50%);
  cursor: pointer;
}
#unitshenghuohui .treebtn1{
  background:url(../assets/showtree.png) no-repeat;
  left:3px;
  width:7px;
  height:28px;
  position:fixed;
  top: calc(50%);
  cursor: pointer;
}
#unitShenghuohuidetail{
  background: #fff;
  border:1px solid #95B8E7;
  height: calc(100% - 140px);
  float: left;
  position: fixed;
  padding:0 !important;
}
#user .el-tree{
  background: #fff;
}
#user .custom-tree-node {
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  padding-right: 8px;
}
#user .treeinput{
  margin: 10px;
  width: 336px !important;
  float:left
}
#user .deptbuttons{
  float:right;
}
#user .depttreebtn{
  float: left;
  margin:10px 10px 0 0 !important;
}
#user .depttreebtn{
  padding: 12px 8px 12px 13px !important;
}
#unitShenghuohuidetail h1{
  height: 30px;
  border-bottom: 1px solid #95B8E7;
  font-family: '宋体';
  line-height: 30px;
  font-size:var(--size14) !important;
  color: #000;
  padding-left:10px;
  background-image: linear-gradient(to bottom , #EEF4FF, #E0ECFF);
  margin:0;
}
#unitShenghuohuidetail h2{
  font-size:var(--size18) !important;
  border-bottom: 1px solid #95B8E7;
  background: #F5F7FA;
  padding:10px 20px;
}
#unitShenghuohuidetail h3{
  width: 180px;
  text-align: right;
  font-size:var(--size18) !important;
}
#unitShenghuohuidetail .module{
  padding:0 20px 20px;
}
#unitShenghuohuidetail .grouptitle{
  font-size:var(--size14) !important;
  line-height: 19px;
  padding:0 20px 0 0;
  font-weight: bolder;
  clear:both;
  width: 200px;
  text-align: right;
  display:block;
  float: left;
}
#unitShenghuohuidetail .submodule{
  padding-bottom:15px;
}
#unitshenghuohui .el-tree{
  display:inline-block;
  min-width: 100%;
}
#unitshenghuohui .el-scrollbar__bar{
  bottom:20px
}
</style>
